<div class="region-goods-details row">

    <div class="region-goods-left col-sm-2">

        商品详情

    </div>

    <div class="region-goods-right col-sm-10">

        <div id="tab-sale-1" class="tab-pane active">

            <div class="form-group">

                <label class="col-lg control-label">

                    促销方式

                </label>

                <div class="col-sm-9 col-xs-12">

                    <label for="isdiscount" class="checkbox-inline">

                        <input type="checkbox" name="isdiscount" value="1" id="isdiscount" {if $item['isdiscount']==1 }checked="true" {/if} onclick="showDiscount(this)"/>

                        促销

                    </label>

                    <label for="istime" class="checkbox-inline">

                        <input type="checkbox" name="istime" value="1" id="istime" {if $item['istime']==1 }checked="true" {/if} onclick="showTime(this)" />

                        限时卖

                    </label>
                </div>

            </div>

            <div id="timediv" class="form-group" {if $item['istime']!=1}style="display:none"

            {/if}>

            <label class="col-lg control-label">

                限时卖时间

            </label>
            <div class="col-sm-4 col-xs-6">

                {:tpl_form_field_daterange('saletime', array('starttime'=>date('Y-m-d H:i', $item['timestart']),'endtime'=>date('Y-m-d H:i', $item['timeend'])),true);}

            </div>

        </div>

        <div id="isdiscount_time" class="form-group" {if $item['isdiscount']!=1}style="display:none"

        {/if}>

        <label class="col-lg control-label">

            促销标题

        </label>

        <div class="col-sm-9 col-xs-12">

            <div class="input-group">

                <input type="text" name="isdiscount_title" maxlength="5" class="form-control"

                       value="{$item['isdiscount_title']}" />

                <p class="help-block">

                    例如 : 季末清仓,双十一促销,品牌日 还可以输入

                                <span id="textCount">

                                    5

                                </span>

                    个字,不输入默认促销

                </p>

            </div>

        </div>

        <label class="col-lg control-label">

            促销结束时间

        </label>

        <div class="col-sm-4 col-xs-6">

            {:tpl_form_field_date('isdiscount_time', !empty($item['isdiscount_time']) ? date('Y-m-d H:i',$item['isdiscount_time']) : date('Y-m-d H:i'),true)}

        </div>

    </div>

    <div id="isdiscount_true">

        <div id="isdiscount_discounts_1">

            <div class="isdiscount_discounts-info">

                <div class="col-sm-12">

                    <div class='alert alert-danger'>

                        详细设置促销价格 :

                        <br>

                        如果填写纯数字我们认为单位是元 例如填写 1 也就是促销价1元

                        <br>

                        如果填写百分数,我们认为是打折数 例如填写 90% 则就是打九折

                    </div>

                </div>

            </div>

            <div id='tbisdiscount_discounts' style="">

                <div class="col-sm-12">

                    <div id="isdiscount_discounts" style="padding:0;">{if $item['hasoption']==1}{$isdiscount_discounts_html}{/if}</div>

                    <div id="isdiscount_discounts_default" style="padding:0;"></div>

                </div>

            </div>

        </div>

    </div>

</div>

    </div>

</div>







<div class="region-goods-details row">

    <div class="region-goods-left col-sm-2">

        促销方式

    </div>

    <div class="region-goods-right col-sm-10">

        <div id="tab-sale-4" class="tab-pane">

            <div class="form-group">

                <label class="col-lg control-label">

                    单品满件包邮

                </label>

                <div class="col-sm-4">

                    <div class='input-group'>

                            <span class="input-group-addon">

                                满

                            </span>

                        <input type="text" name="ednum" value="{$item['ednum']}" class="form-control"

                        />

                            <span class="input-group-addon">

                                件

                            </span>

                    </div>

                        <span class="help-block">

                            如果设置0或空，则不支持满件包邮

                        </span>

                </div>

            </div>

            <div class="form-group">

                <label class="col-lg control-label">

                    单品满额包邮

                </label>

                <div class="col-sm-4">

                    <div class='input-group'>

                            <span class="input-group-addon">

                                满

                            </span>

                        <input type="text" name="edmoney" value="{$item['edmoney']}" class="form-control"

                        />

                            <span class="input-group-addon">

                                元

                            </span>

                    </div>

                        <span class="help-block">

                            如果设置0或空，则不支持满额包邮

                        </span>

                </div>

            </div>



            <div class="form-group">

                <label class="col-sm-2 control-label">不参与单品包邮地区</label>

                <div class="col-sm-9 col-xs-12">

                    <div id="areas" class="form-control-static">{$item['edareas']}</div>

                    <a href="javascript:;" class="btn btn-default" onclick="selectAreas()">添加不参加满包邮的地区</a>

                    <input type="hidden" id='selectedareas' name="edareas" value="{$item['edareas']}"/>

                    <input type="hidden" id='selectedareas_code' name="edareas_code" value="{$item['edareas_code']}"/>

                    <span class="help-block">如果设置0或空，则不支持满件包邮</span>

                </div>

            </div>

        </div>

    </div>

</div>



<script>

    $(document).ready(function() {

        var Discount = document.getElementById("isdiscount");

        showDiscount(Discount);

    });

    function showTime(obj) {

        if (obj.checked) {

            $('#timediv').show();

            $('#isdiscount_time').hide();

            $('input[name="isdiscount"]').removeAttr('checked');

            $('#isdiscount_true').hide();

        } else {

            $('#timediv').hide();

        }

    }

    function showDiscount(obj) {

        if (obj.checked) {

            $('input[name="istime"]').removeAttr('checked');

            $('#timediv').hide();

            $('#isdiscount_time').show();

            $('#isdiscount_true').show();

        } else {

            $('#isdiscount_time').hide();

            $('#isdiscount_true').hide();

        }

    }

    function isdiscount_change() {

        var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">{loop $levels $level}<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level["levelname"]}</div></div></th>{/loop}</tr></thead><tbody><tr>{loop $levels $level}{if $level["key"]=="merch"}<td><input name="isdiscount_discounts_level_{$level["key"]}_default" type="text" class="form-control isdiscount_discounts_{$level["key"]} isdiscount_discounts_{$level["key"]}_default" value="{:is_array($isdiscount_discounts[$level["key"]]["option0"]) ? '' : $isdiscount_discounts[$level["key"]]["option0"];}" placeholder="促销价格单位: 元"></td>{else}<td><input name="isdiscount_discounts_level_{$level["id"]}_default" type="text" class="form-control isdiscount_discounts_level{$level["id"]} isdiscount_discounts_level{$level["id"]}_default" value="{:is_array($isdiscount_discounts["level".$level["id"]]["option0"]) ? '' : $isdiscount_discounts["level".$level["id"]]["option0"];}" placeholder="促销价格单位: 元"></td>{/if}{/loop}</tr></tbody></table>';

        if ($("#isdiscount_discounts").html()=='')

        {

            $("#isdiscount_discounts_default").html(html);

        }

        else

        {

            $("#isdiscount_discounts_default").html('');

        }

    }



    isdiscount_change();

</script>

{if empty($new_area)}

{include file='shop/selectareas'}

{else}

{include file='shop/selectareasNew'}

{/if}

